<template>
  <div
    class="btn"
    @click="hardler"
    :class="{
      btn: type == 'btn',
      primay: type == 'primay',
      warnary: type == 'warnary',
    }"
  >
    <!-- 插槽的使用 -->
    <slot></slot>
  </div>
</template>
<script>
export default {
  props: ["type"],
  methods: {
    hardler(e) {
      // 发出事件 后面需要监听事件
      this.$emit("click", e);
      // console.log(e);
    },
  },
};
</script>
<style lang="less" scoped>
.btn {
  width: 318 * 100vw/360;
  height: 50px;
  background-color: rgb(70, 158, 12);
  border-radius: 25px;
  line-height: 50px;
  text-align: center;
  color: #fff;
  font-weight: bold;
  font-size: 20px;
}
.primay {
  background-color: skyblue;
  color: #fff;
}
.warnary {
  background-color: orange;
  color: #fff;
}
</style>